package com.tp;

import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;

public class Main extends CustomWindow implements OnClickListener {
	
String types[] = { "Report Schedule", "Post comment", "Up photo" };
	@Override
	public void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
	//	Debug.startMethodTracing("calc");
		setContentView(R.layout.activity_main);
		this.title.setText("Travel Diary");
		this.icon.setImageResource(R.drawable.travel_icon);
		View search = (findViewById(R.id.search));
		search.setOnClickListener(this);
		View add = (findViewById(R.id.add));
		add.setOnClickListener(this);
		View create = (findViewById(R.id.create));
		create.setOnClickListener(this);
		View diary = (findViewById(R.id.diary));
		diary.setOnClickListener(this);
		View info = (findViewById(R.id.info));
		info.setOnClickListener(this);
		
		View exit = (findViewById(R.id.exit));
		exit.setOnClickListener(this);
		//Debug.stopMethodTracing();

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v) {
		Intent i;
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.search:
			/*i = new Intent(this, SearchObject.class);
			startActivity(i);*/
			new Search(this);
			break;
		case R.id.add:
			Add.flag =0;
			i = new Intent(this, Add.class);
			startActivity(i);
			break;
		case R.id.create:
			i = new Intent(this, Create.class);
			startActivity(i);
			break;
		case R.id.diary:
			
			 i = new Intent(this, Trip.class); 
			 startActivity(i);
			 
			/*DialogCustomize diary = new DialogCustomize();
			diary.a(this, types, "Note Diary");*/
			break;
		case R.id.info:
			startActivity(new Intent(this, Info.class));
			break;
		case R.id.exit:
			Constant.user =0;
			Intent intent = new Intent(this,Login.class);

		    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

		    startActivity(intent);
			finish();
			break;

		}

	}

}
